package com.cs.paoyer.administration.business.client;

//import com.cs.beneficios.business.entity.AdministrationFacadeLocalLocal;
import com.cs.paoyer.administration.business.model.ContractVO;
import java.util.Collection;
//import java.rmi.RemoteException;
import java.util.*;

import com.cs.paoyer.administration.business.model.FDClassVO;
import com.cs.paoyer.administration.business.model.FDTypeVO;
import com.cs.paoyer.administration.business.model.UserVO;
import com.cs.paoyer.administration.business.model.ApplicationVO;
import com.cs.paoyer.administration.business.model.UserGroupVO;
import com.cs.paoyer.administration.business.model.OptionVO;
import com.cs.paoyer.administration.business.model.ProgramVO;
import com.cs.paoyer.administration.business.model.ProgramParameterVO;
import com.cs.paoyer.administration.business.model.UserGroupOptionVO;
import com.cs.paoyer.administration.business.model.ApplicationUserVO;
import com.cs.paoyer.administration.business.model.FDVO;
import com.cs.paoyer.administration.business.model.FlexValueVO;
import com.cs.paoyer.administration.business.model.AuthorizedByBranchVO;
import com.cs.paoyer.administration.business.model.WarehouseByBranchVO;
import com.cs.paoyer.administration.business.model.CostCenterByAuthorizedVO;


import com.cs.paoyer.administration.business.AdministrationFacade;
//import com.cs.beneficios.business.entity.AdministrationFacadeLocal;
import com.cs.paoyer.administration.util.AdministrationServiceLocator;
import com.cs.paoyer.common.exception.UserException;
import com.cs.paoyer.common.exception.SystemException;
import com.cs.paoyer.common.exception.ExceptionAssembler;


/**
 * La clase AdministrationBusinessDelegate, permite establecer una clara separacion
 * entre la logica del negocio y el componente del cliente, utiliza la definicion de
 * los metodos declarados en el Facade (Bean de Sesion).
 *
 */
public class AdministrationDelegate 
{
		AdministrationServiceLocator locator = null;
		AdministrationFacade facade = null;

		/**
		 * Constructor que inicializa la localizacion de componentes de negocio 
		 * de los m�dulos.
		 * @param locator Referencia a la interfaz remota del facade del modulo de Sistema.
		 */
		public AdministrationDelegate()
		{
				locator = new AdministrationServiceLocator();
				facade = locator.getAdministrationFacade();
		}
    

		public String getMenu(String strUserGroup, String strPath) 
		{
				try
				{
						return facade.getMenu(strUserGroup,strPath);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
    public Vector getResources(UserVO criterea)
		{
				try
				{
						return facade.getResources(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
     public UserVO userGroup(UserVO user) 
		{
				try
				{
						return facade.userGroup(user);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
    public UserVO authenticateUser(UserVO user) 
		{
				try
				{
						return facade.authenticateUser(user);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findUserByCriterea(UserVO user) throws UserException, SystemException
		{
				try
				{
						return facade.findUserByCriterea(user);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
    public boolean createUser(UserVO user) throws UserException, SystemException
		{
				try
				{
						return facade.createUser(user);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public boolean updateUser(UserVO user) throws UserException, SystemException
		{
				try
				{
						return facade.updateUser(user);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public boolean deleteUser(UserVO user) throws UserException, SystemException
		{
				try
				{
						return facade.deleteUser(user);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
//------------------------------------------------------------------------------

		public ApplicationVO createApplication(ApplicationVO application) throws UserException, SystemException
		{
				try
				{
						return facade.createApplication(application);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findApplicationByCriterea(ApplicationVO application) throws UserException, SystemException
		{
				try
				{
						return facade.findApplicationByCriterea(application);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public int updateApplication(ApplicationVO application) throws UserException, SystemException
		{
				try
				{
						return facade.updateApplication(application);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public int deleteApplication(ApplicationVO application) throws UserException, SystemException
		{
				try
				{
						return facade.deleteApplication(application);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public UserGroupVO createUserGroup( UserGroupVO newUserGroup ) throws UserException, SystemException
		{
				try
				{
						return facade.createUserGroup(newUserGroup);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findUserGroupByCriterea(UserGroupVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findUserGroupByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public UserGroupVO updateUserGroup( UserGroupVO userGroup ) throws UserException, SystemException
		{
				try
				{
						return facade.updateUserGroup(userGroup);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public void deleteUserGroup( UserGroupVO userGroup ) throws UserException, SystemException
		{
				try
				{
						facade.deleteUserGroup(userGroup);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}



		public OptionVO createOption( OptionVO newOption ) throws UserException, SystemException
		{
				try
				{
						return facade.createOption(newOption);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findOptionByCriterea(OptionVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findOptionByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public OptionVO updateOption( OptionVO option ) throws UserException, SystemException
		{
				try
				{
						return facade.updateOption(option);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public void deleteOption( OptionVO option ) throws UserException, SystemException
		{
				try
				{
						facade.deleteOption(option);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}



		public ProgramVO createProgram( ProgramVO newProgram ) throws UserException, SystemException
		{
				try
				{
						return facade.createProgram(newProgram);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findProgramByCriterea(ProgramVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findProgramByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public ProgramVO updateProgram( ProgramVO program ) throws UserException, SystemException
		{
				try
				{
						return facade.updateProgram(program);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public void deleteProgram( ProgramVO program ) throws UserException, SystemException
		{
				try
				{
						facade.deleteProgram(program);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}





		public ProgramParameterVO createProgramParameter( ProgramParameterVO newProgramParameter ) throws UserException, SystemException
		{
				try
				{
						return facade.createProgramParameter(newProgramParameter);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findProgramParameterByCriterea(ProgramParameterVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findProgramParameterByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public ProgramParameterVO updateProgramParameter( ProgramParameterVO program ) throws UserException, SystemException
		{
				try
				{
						return facade.updateProgramParameter(program);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public void deleteProgramParameter( ProgramParameterVO program ) throws UserException, SystemException
		{
				try
				{
						facade.deleteProgramParameter(program);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}





		public UserGroupOptionVO createUserGroupOption( UserGroupOptionVO newUserGroupOption ) throws UserException, SystemException
		{
				try
				{
						return facade.createUserGroupOption(newUserGroupOption);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}


public boolean asociateOptionToUserGroup(UserGroupOptionVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.asociateOptionToUserGroup(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
		public Collection findUserGroupOptionByCriterea(UserGroupOptionVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findUserGroupOptionByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
    public Collection findNotAsociatedOptionByCriterea(UserGroupOptionVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findNotAsociatedOptionByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public UserGroupOptionVO updateUserGroupOption( UserGroupOptionVO userGroupOption ) throws UserException, SystemException
		{
				try
				{
						return facade.updateUserGroupOption(userGroupOption);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public void deleteUserGroupOption( UserGroupOptionVO userGroupOption ) throws UserException, SystemException
		{
				try
				{
						facade.deleteUserGroupOption(userGroupOption);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}




		public ApplicationUserVO createApplicationUser( ApplicationUserVO newApplicationUser ) throws UserException, SystemException
		{
				try
				{
						return facade.createApplicationUser(newApplicationUser);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}


    public Collection findUserNotAsociatedByCriterea(ApplicationUserVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findUserNotAsociatedByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
		public Collection findApplicationUserByCriterea(ApplicationUserVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findApplicationUserByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public ApplicationUserVO updateApplicationUser( ApplicationUserVO applicationUser ) throws UserException, SystemException
		{
				try
				{
						return facade.updateApplicationUser(applicationUser);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public void deleteApplicationUser( ApplicationUserVO applicationUser ) throws UserException, SystemException
		{
				try
				{
						facade.deleteApplicationUser(applicationUser);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}




		public FlexValueVO createFlexValue( FlexValueVO newFlexValue ) throws UserException, SystemException
		{
				try
				{
						return facade.createFlexValue(newFlexValue);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findFlexValueByCriterea(FlexValueVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findFlexValueByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public boolean updateFlexValue( FlexValueVO flexValue ) throws UserException, SystemException
		{
				try
				{
						return facade.updateFlexValue(flexValue);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public boolean deleteFlexValue( FlexValueVO flexValue ) throws UserException, SystemException
		{
				try
				{
						return facade.deleteFlexValue(flexValue);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

  public Collection findFlexValueTypeByCriterea(FlexValueVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findFlexValueTypeByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

  public FlexValueVO createFlexValueType( FlexValueVO flexValueType ) throws UserException, SystemException
		{
				try
				{
						return facade.createFlexValueType(flexValueType);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
  public boolean updateFlexValueType( FlexValueVO flexValueType ) throws UserException, SystemException
		{
				try
				{
						return facade.updateFlexValueType(flexValueType);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
	public boolean deleteFlexValueType( FlexValueVO flexValueType ) throws UserException, SystemException
		{
				try
				{
						return facade.deleteFlexValueType(flexValueType);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}		

		//Consultas

		public Collection findInventoryByCriterea(FDVO fd) throws UserException, SystemException
		{
				try
				{
						return facade.findInventoryByCriterea(fd);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

    public Collection findContractByCriterea(ContractVO criterea) throws UserException, SystemException
		{
				try
				{
						return facade.findContractByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
    public Collection findAuthorizedBranchByCriterea(AuthorizedByBranchVO criterea)
		{
				try
				{
						return facade.findAuthorizedBranchByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}



		public Collection findWarehouseBranchByCriterea(WarehouseByBranchVO criterea)
		{
				try
				{
						return facade.findWarehouseBranchByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}


		public Collection findCostCenterAuthorizedByCriterea(CostCenterByAuthorizedVO criterea)
		{
				try
				{
						return facade.findCostCenterAuthorizedByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}
    
    public Collection findFDClassByCriterea(FDClassVO criterea)
		{
				try
				{
						return facade.findFDClassByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}



		public Collection findFDTypeByCriterea(FDTypeVO criterea)
		{
				try
				{
						return facade.findFDTypeByCriterea(criterea);
				} 
				catch (Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

		public Collection findFDHistoryByCriterea(FDVO criterea)
		{
				try
				{
						return facade.findFDHistoryByCriterea(criterea);
				} 
				catch (/*RemoteException*/Exception e) 
				{
						throw ExceptionAssembler.getException(e);
				}
		}

}